home *** CD-ROM | disk | FTP | other *** search
- { %filename% -- document methods }
- { Created %date% %time% by AppMaker }
-
- { We recommend that you not modify this module and instead modify }
- { its subclass, %Appname%Doc. The 'z' prefix on this module marks% %}
- { a module which is likely to be regenerated by AppMaker after you }
- { make changes to the user interface. The modules without the 'z' }
- { prefix will not be regenerated by AppMaker unless you delete them. }
- { Using a separate subclass to override the AppMaker-generated code }
- { lets you regenerate code without losing your hand-coded changes. }
-
- Unit %unitname%;
- Interface
-
- Uses
- TCL,
- AMCL,
- %AppName%Intf,
- %if fileExists appname+Doc.p%
- %for each dialog gen usesDocDialogs%
- %endif%
- ResourceDefs;
-
- {----------}
- Implementation
-
- {----------}
- Procedure Z%Appname%Doc.I%Appname%Doc (aSupervisor: CApplication;
- printable: Boolean);
- Begin
- inherited IDocument (aSupervisor, printable);
- itsData := nil;
-
- End; {I%Appname%Doc}
-
- {----------}
- Procedure Z%Appname%Doc.Free;
- Begin
- ForgetObject (itsData);
- itsFile := nil; {was disposed by ForgetObject (itsData) }
- inherited Free;
- End; {Free}
-
- {----------}
- Procedure Z%Appname%Doc.NewFile;
- Begin
- New (itsData);
- itsData.I%Appname%Data (self);
-
- BuildWindows;
-
- if itsWindow <> nil then begin
- itsWindow.Select;
- end;
- End; {NewFile}
-
- {----------}
- Procedure Z%Appname%Doc.OpenFile (macSFReply: SFReply);
- var
- theName: Str255;
- Begin
- New (itsData);
- itsData.I%Appname%Data (self);
- itsData.SFSpecify (macSFReply);
- itsData.OpenData (fsRdWrPerm);
- itsFile := itsData;
-
- BuildWindows;
-
- itsFile.GetName (theName);
- if itsWindow <> nil then begin
- itsWindow.SetTitle (theName);
- itsWindow.Select;
- end;
- End; {OpenFile}
-
- {----------}
- Procedure Z%Appname%Doc.BuildWindows;
- %for each window gen instance%
- Begin
- %for each window gen create%
-
- End; {BuildWindows}
-
- {----------}
- Function Z%Appname%Doc.DoSave: Boolean;
- Begin
- if itsFile = nil then begin
- DoSave := DoSaveFileAs;
- end else begin
- if itsData.Save then begin
- dirty := false;
- DoSave := true;
- end else begin
- DoSave := false;
- end;
- end;
- End; {DoSave}
-
- {----------}
- Function Z%Appname%Doc.DoSaveAs (macSFReply: SFReply): Boolean;
- Begin
- if itsData.SaveAs (macSFReply) then begin
- itsFile := itsData;
- if itsWindow <> nil then begin
- itsWindow.SetTitle (macSFReply.fName);
- end;
- dirty := false;
- DoSaveAs := true;
- end else begin
- DoSaveAs := false;
- end;
- End; {DoSaveAs}
-
- {----------}
- Procedure Z%Appname%Doc.DoRevert;
- Begin
- itsData.Revert;
- dirty := false;
-
- End; {DoRevert}
-
- %if fileExists appname+Doc.p%
- {----------}
- { This code should be in %Appname%Doc.p rather than in this file. }
- { AppMaker generated it here because %Appname%Doc.p already existed. }
- { AppMaker doesn't overwrite an existing non-Z file because it }
- { might have lots of user hand-written code. }
- {----------}
- Procedure Z%Appname%Doc.UpdateMenus;
- Begin
- inherited UpdateMenus;
- %for each menu gen updateDocMenus%
-
- End; {UpdateMenus}
-
- {----------}
- Procedure Z%Appname%Doc.DoCommand (theCommand: longint);
- Begin
- case theCommand of
- 0: ;
- %for each menu gen handleDocItems%
-
- otherwise
- inherited DoCommand (theCommand);
- end; {case}
- End; {DoCommand}
-
- %endif%
- End. {%unitname%}
-